<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/head :: head"></head>
<body class="gray-bg">
<form id="ec" action="/admin" method="post">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <table class="table form-table margin-bottom10">
                        <tr>
                            <td>
                                <input type="text" name="name" th:value="${#maps.containsKey(filters,'name')}? ${filters.name}:''" placeholder="用户名称" class="input-sm form-control"/>
                            </td>
                            <td>
                                <input type="text" name="username" th:value="${#maps.containsKey(filters,'username')}? ${filters.username}:''" placeholder="账号名称" class="input-sm form-control"/>
                            </td>
                            <td>
                                <input type="text" name="phone" th:value="${#maps.containsKey(filters,'phone')}? ${filters.phone}:''" placeholder="手机号码" class="input-sm form-control"/>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="text" name="createTimeBegin" th:value="${#maps.containsKey(filters, 'createTimeBegin')} ? ${filters.createTimeBegin} : ''" placeholder="开始日期：YYYY-MM-DD" class="input-sm form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                            </td>
                            <td>
                                <input type="text" name="createTimeEnd" th:value="${#maps.containsKey(filters, 'createTimeEnd')} ? ${filters.createTimeEnd} : ''" placeholder="截止日期：YYYY-MM-DD" class="input-sm form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                    <div>
                        <button type="submit" class="btn btn-sm btn-primary create" onclick="javascript:document.forms.ec.pageNum.value=1;">搜索</button>
                        <button type="button" class="btn btn-sm btn-primary create">新增</button>
                    </div>

                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>头像</th>
                            <th>账号名称</th>
                            <th>用户名称</th>
                            <th>手机号码</th>
                            <th>描述</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            <tr class="gradeX" th:each="item,it : ${page.list}">
                                <td class="text-center" th:text="${it.count}">11</td>
                                <td>
                                    <img th:src="${item.headUrl}" style="width: 60px; height: 60px;">
                                </td>
                                <td th:text="${item.username}">33</td>
                                <td th:text="${item.name}">33</td>
                                <td th:text="${item.phone}">33</td>
                                <td th:text="${item.description}">33</td>
                                <td th:text="${#dates.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}" >33</td>
                                <td>
                                    <!--将id值赋值给临时属性，便于jQuery获取id-->
                                    <a class="edit" th:attr="data-id=${item.id}">修改</a>
                                    <a class="delete" th:attr="data-id=${item.id}">删除</a>
                                </td>
                            </tr>


                        </tbody>
                    </table>

                    <div class="row" th:include="common/pagination :: pagination"></div>
                </div>
            </div>
        </div>
    </div>
</div>
</form>


<script th:inline="javascript">

    $(function(){
        $(".create").on("click",function () {
           opt.openWin("/admin/create","新增",580,430)
        })

        $(".edit").on("click",function () {
            var id = $(this).attr("data-id");
            opt.openWin("/admin/edit/"+id,"修改",580,430)
        });

        $(".delete").on("click",function () {
            var id = $(this).attr("data-id");
            opt.confirm("/admin/delete/"+id,"确认要删除吗?");
        });
    });
</script>


</body>
</html>